const state = {
	userInfo: uni.getStorageSync("USER_INFO") || {
		account: "",
		class: "",
		id: 0,
		name: "",
		password: "",
		sex: null,
		study_id: "",
		token: null,
		avatar: ''
	}
};
const mutations = {
	setUserInfo(state, newInfo) {
		Object.assign(state.userInfo, newInfo)
		uni.setStorageSync('USER_INFO', state.userInfo);
	},
	logout(state) {
		uni.clearStorage()
		state.userInfo = {
			account: "",
			class: "",
			id: 0,
			name: "",
			password: "",
			sex: null,
			study_id: "",
			token: null,
			avatar: ''
		}
	}
};
const actions = {};
const getters = {};

export default {
	namespaced: true,
	state,
	mutations,
	actions,
	getters,
};
